package com.wiloon.androidx.service;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;

public class LocalService extends Service {

	private static final String tag = "local service";

	@Override
	public IBinder onBind(Intent arg0) {
		Log.d(tag, "onBind");
		return binder;
	}

	@Override
	public boolean onUnbind(Intent arg0) {
		Log.d(tag, "on un bind");
		return true;
	}

	@Override
	public void onCreate() {
		Log.d(tag, "onCreate");
		super.onCreate();
	}

	@Override
	public void onStart(Intent intent, int startId) {
		Log.d(tag, "onStart");
		super.onStart(intent, startId);
	}

	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {
		Log.d(tag, "onStart");
		return START_STICKY;
	}

	@Override
	public void onDestroy() {
		Log.d(tag, "onDestroy");
		super.onDestroy();
	}

	private final IBinder binder = new LocalBinder();

	public class LocalBinder extends Binder {
		public LocalService getService() {
			return LocalService.this;
		}
	}

	public String getTag() {
		return tag;
	}
}
